package ch.uzh.ifi.seal.ssqa.ui.providers;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.zest.core.viewers.IFigureProvider;

import ch.uzh.ifi.seal.ssqa.model.Source;
import ch.uzh.ifi.seal.ssqa.ui.figures.SourceFigure;

public class SourceFigureProvider implements IFigureProvider, IBaseLabelProvider{

	private String mapping; 
	
	public void setMapping(String mapping){
		this.mapping = mapping;
	}
	
	@Override
	public IFigure getFigure(Object element) {
		Source source = (Source)element;
		SourceFigure figure = new SourceFigure(new Label(source.getName()), source);
		if(!source.getDiagramMapping().equals(this.mapping)){
			figure.setInactive();
		}
		return figure;
	}

	@Override
	public void addListener(ILabelProviderListener listener) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isLabelProperty(Object element, String property) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener listener) {
		// TODO Auto-generated method stub
		
	}

}
